<?php 
class productdetail
{
        private $id;
        private $vi_name;
        private $en_name;
        private $category_level_1_id;
        private $category_level_2_id;
        private $category_level_3_id;
        private $product_fit_id;
        private $product_crotch_id;
        private $product_code_id;
        private $product_price_id;
        private $product_side_id;
        private $description;
		
        public function get_productdetail($id)
        {
                $m_query = "select * from product_detail where id='{$id}'";
                $m_sql = mysql_query($m_query);
                if(isset($m_sql) && mysql_num_rows($m_sql)>0)
                {
                        $m_result = mysql_fetch_assoc($m_sql);
                        $this->id = $m_result['id'];
                        $this->vi_name = $m_result['vi_name'];
                        $this->en_name = $m_result['en_name'];
                        $this->category_level_1_id = $m_result['category_level_1_id'];
                        $this->category_level_2_id = $m_result['category_level_2_id'];
                        $this->category_level_3_id = $m_result['category_level_3_id'];
                        $this->product_fit_id = $m_result['product_fit_id'];
                        $this->product_crotch_id = $m_result['product_crotch_id'];
                        $this->product_code_id = $m_result['product_code_id'];
                        $this->product_price_id = $m_result['product_price_id'];
                        $this->product_side_id = $m_result['product_side_id'];
                        $this->description = $m_result['description'];
                }
        }
		
        public function get_id()
        {
                return $this->id;
        }

        public function set_id($id)
        {
                $this->id = $id;
        }
		
        public function get_vi_name()
        {
                return $this->vi_name;
        }
        
        public function get_en_name()
        {
                return $this->en_name;
        }
        
		public function set_vi_name($vi_name)
        {
                $this->vi_name = $vi_name;
        }
        
        public function set_en_name($en_name)
        {
                $this->en_name = $en_name;
        }
		
        public function get_category_level_1_id()
        {
                return $this->category_level_1_id;
        }

        public function set_category_level_1_id($category_level_1_id)
        {
                $this->category_level_1_id = $category_level_1_id;
        }
		
        public function get_product_side_id()
        {
                return $this->product_side_id;
        }

        public function set_product_side_id($product_side_id)
        {
                $this->product_side_id = $product_side_id;
        }
		
        public function get_product_price_id()
        {
                return $this->product_price_id;
        }

        public function set_product_price_id($product_price_id)
        {
                $this->product_price_id = $product_price_id;
        }
		
        public function get_description()
        {
                return $this->description;
        }

        public function set_description($description)
        {
                $this->description = $description;
        }
		
        public function get_product_code_id()
        {
                return $this->product_code_id;
        }

        public function set_product_code_id($product_code_id)
        {
                $this->product_code_id = $product_code_id;
        }
		
        public function get_product_crotch_id()
        {
                return $this->product_crotch_id;
        }

        public function set_product_crotch_id($product_crotch_id)
        {
                $this->product_crotch_id = $product_crotch_id;
        }
		
        public function get_category_level_2_id()
        {
                return $this->category_level_2_id;
        }

        public function set_category_level_2_id($category_level_2_id)
        {
                $this->category_level_2_id = $category_level_2_id;
        }
        
        public function get_category_level_3_id()
        {
                return $this->category_level_3_id;
        }

        public function set_category_level_3_id($category_level_3_id)
        {
                $this->category_level_3_id = $category_level_3_id;
        }
        
        public function get_product_fit_id()
        {
                return $this->product_fit_id;
        }

        public function set_product_fit_id($product_fit_id)
        {
                $this->product_fit_id = $product_fit_id;
        }
        
     
        public function create()
        {
                $m_query = "insert into product_detail (vi_name,en_name,category_level_1,category_level_2_id,
										category_level_3_id,product_fit_id,product_crotch_id,product_code_id,product_price_id,product_size_id,description)
                                        values ('{$this->vi_name}','{$this->en_name}','{$this->category_level_1_id}','{$this->category_level_2_id}',
												'{$this->category_level_3_id}','{$this->product_fit_id}','{$this->product_crotch_id}',
												'{$this->product_code_id}','{$this->product_price_id}','{$this->product_size_id}','{$this->description}')";
                $m_sql = mysql_query($m_query);
                if($m_sql)
                        return true;
                else return false;
        }
        
        public function update()
        {
                $m_query = "update product_detail 
                                        set vi_name='{$this->vi_name}',
											en_name='{$this->en_name}',
											category_level_1='{$this->category_level_1}',
											category_level_2_id='{$this->category_level_2_id}',
											category_level_3_id='{$this->category_level_3_id}',
											product_fit_id='{$this->product_fit_id}',
											product_crotch_id='{$this->product_crotch_id}',
											product_code_id='{$this->product_code_id}',
											product_price_id='{$this->product_price_id}',
											product_size_id='{$this->product_size_id}',
											code='{$this->code}',
                                            description='{$this->description}' 
                                        where id={$this->id}";
                $m_sql = mysql_query($m_query);
                if($m_sql)
                        return true;
                else return false;
        }
		
        public function del()
        {
                $m_query = "delete from product_detail where id={$this->id}";
                $m_sql = mysql_query($m_query);
                if($m_sql)
                        return true;
                else return false;
        }
}

?>